package com.mini.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author zhangxiaobin
 * @title: BaseCondition
 * @description:
 * @date 2019/10/2714:04
 */
@Data
public class BaseCondition extends BaseSortCondition implements Serializable {

    @ApiModelProperty(value = "分页-页码,从1开始，默认：1", required = true)
    private Integer pageNumber = 1;

    @ApiModelProperty(value = "分页-页大小，最小10，最大100，默认：10", required = true)
    private Integer pageSize = 10;


    @ApiModelProperty(value="分页-内部运算使用",hidden = true)
    private Integer offset;
    @ApiModelProperty(value="分页-内部运算使用",hidden = true)
    private Integer limit;


    public Integer getOffset() {
        if(pageNumber == null || pageSize== null){
            offset = null;
        }else {
            offset = (pageNumber-1) * pageSize;
        }

        return offset;
    }

    public Integer getLimit() {
        limit = pageSize;
        return limit;
    }

}
